/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ie.tcd.cs.railtickets.server.domain;

import java.util.Date;
import java.io.Serializable;
import javax.persistence.JoinColumn;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Wenbo Sun
 */
@Entity
@Table(name = "seat_state")
public class SeatState implements Serializable {

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "seat_state_id")
    private long id;

    @Column(name = "travel_date")
    @Temporal(TemporalType.DATE)
    private Date travelDate;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "time_id")
    private RouteTime travelTime;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "route_station_id")
    private RouteStation routeStation;

    @Column(name = "seat_avail")
    private int seatAvail;

    public SeatState() {
    }

    public SeatState(long id) {
        this.id = id;
    }

    public SeatState(Date travelDate, RouteTime travelTime, RouteStation routeStation, int seatAvail) {
        this.travelDate = travelDate;
        this.travelTime = travelTime;
        this.routeStation = routeStation;
        this.seatAvail = seatAvail;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public int getSeatAvail() {
        return seatAvail;
    }

    public void setSeatAvail(int seatAvail) {
        this.seatAvail = seatAvail;
    }

    public Date getTravelDate() {
        return travelDate;
    }

    public void setTravelDate(Date travelDate) {
        this.travelDate = travelDate;
    }

    public TimeTable getTravelTime() {
        return travelTime;
    }

    public void setTravelTime(RouteTime travelTime) {
        this.travelTime = travelTime;
    }

    public RouteStation getRouteStation() {
        return routeStation;
    }

    public void setRouteStation(RouteStation routeStation) {
        this.routeStation = routeStation;
    }

    

}
